package com.lagou.task12;

public class StringConstructorTest {
    public static void main(String[] args) {
        String s1 = new String();
        System.out.println("s1 = " + s1);

//        2.使用指定参数的数组构造对象
        byte[] barr = {'a','b','c','d','e'};
        byte[] barr2 = {97,98,99,100,101};
        String s2 = new String(barr,1,3);
        String s3 = new String(barr2,1,3);
        System.out.println("s2 = " + s2);
        System.out.println("s3 = " + s3);
        //使用整个数组构造
        String s4 = new String(barr);
        System.out.println("s4 = " + s4);

        String s5 = new String("hello");
        System.out.println("s5 = " + s5);
    }

}
